# Importing Data
ITALY<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "U1:U229")

# Checking the Imported Data
View(ITALY)
# Creating Time Series Data
ITALY_ts <- ts(ITALY, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
ITALY_ts
sum(is.na(ITALY_ts))
library(forecast)
ITALY_ts <- tsclean(ITALY_ts)
ITALY_ts

# Identification: Plotting the Time Series Data
plot(ITALY_ts)

# Estimating the appropriate model
ITALY_ts_model <- auto.arima(ITALY_ts)
ITALY_ts_model

# Forecasting
options(max.print=1000000)
ITALY_ts_forecast <- forecast (ITALY_ts_model, level=c(95), h=288)
plot(ITALY_ts_forecast)
ITALY_ts_forecast             

# Exporting
write.table(ITALY_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/ITALY_TSA.csv", sep=",")
